package com.iot.controller;

import com.iot.model.dto.UserInfoDto;
import com.iot.model.query.UserInfoQuery;
import com.iot.commons.ResponseResult;
import com.iot.service.UserInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 
 * @author: dh
 * @date: 2024-04-20 17:20:48
 */
@RestController
@RequestMapping("/userInfo")
@RequiredArgsConstructor
public class UserInfoController {

    private final UserInfoService userInfoService;

    /**
     * 分页条件搜索实现
     * @param userInfo
     * @return resultList
     */
    @PostMapping(value = "/getList")
    public ResponseResult getList(@RequestBody UserInfoQuery userInfo) {
        return  userInfoService.getList(userInfo);
    }

    /**
     * 修改
     * @param userInfo
     * @return
     */
    @PostMapping(value = "/edit")
    public ResponseResult edit(@RequestBody UserInfoDto userInfo) {
        return userInfoService.edit(userInfo);
    }

    /**
     * 修改cid
     * @param userInfo
     * @return
     */
    @PostMapping(value = "/cid")
    public ResponseResult cid(@RequestBody UserInfoDto userInfo) {
        return userInfoService.cid(userInfo);
    }

    /**
     * 修改cid
     * @return
     */
    @PostMapping(value = "/cidClear")
    public ResponseResult cidClear() {
        return userInfoService.cidClear();
    }

    /**
     * 新增
     * @param userInfo
     * @return
     */
    @PostMapping(value = "/add")
    public ResponseResult add(@RequestBody UserInfoDto userInfo) {
        return userInfoService.add(userInfo);
    }

    /**
     * 详情
     * @param userInfo
     * @return
     */
    @PostMapping(value = "/getById")
    public ResponseResult getById(@RequestBody UserInfoQuery userInfo) {
        return userInfoService.getById(userInfo);
    }
}
